package pl.ydp.storage.events
{
	import flash.events.Event;

	/**
	 * Class specifies structure of error events that are dispatched 
	 * while performing resource operations
	 * @see IResource 
	 */

	public class StorageErrorEvent extends Event
	{
		
		
		/**
		 * hold storage operation error number
		 * @see StorageErrorInfo 
		 */
		protected var m_errorCode:Number;
		
		/**
		 * additional error info passed with the event
		 */
		protected var m_details:Object;
		
		
		public static const LOAD_ERROR:String = "fileLoadError";
		public static const REMOVE_ERROR:String = "removeFileError";
		public static const SAVE_ERROR:String = "saveFileError";
		public static const PUT_ERROR:String = "putFileError";
		public static const LIST_DIR_ERROR:String = "listDirError";
		public static const PUT_FILE_NAME_ERROR:String = "putFileNameError";
		public static const FILE_TOO_LARGE_ERROR:String = "fileTooLargeError";
		public static const COPY_ERROR:String = "copyFileError";
		public static const PROPERTY_LIST_ERROR:String = "propertyListError";
		public static const MAKE_ICON_ERROR:String = "makeIconError";
		public static const SET_BEGIN_ERROR:String = "setBeginError";
		public static const SET_END_ERROR:String = "setEndError";
		public static const PING_ERROR:String = "pingError";
		public static const CREATE_DIR_ERROR:String = "createDirError";
	
		/**
		 * Class contructor 
		 * @param errCode code related to the reason of error occurance.
		 * @type const specified in StorageErrorEvent class
		 * @details additional operation info ( by deafult 'null' )
		 * @see pl.ydp.storage.StorageErrorInfo  
		 */
		public function StorageErrorEvent( type:String, errCode:Number, details:Object = null)
		{
			m_errorCode = errCode;
			m_details = details;
			super( type );
		}
		
		/**
		 * Returns operation error number
		 * 
		 */ 
		public function get errorCode ():Number{
			return m_errorCode;
		}
		
		/**
		 * Returns additional info about the error
		 * 
		 */
		public function get details ():Object{
			return m_details;
		}
	}
}